home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 March / Ahoy_Magazine_85-03_1985_Double_L.d64 / mansion game (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  10KB  |  329 lines

  1. 1 rem solve the mansion murder--display
  2. 2 rem
  3. 7 rem
  4. 8 rem relocate basic variable storage
  5. 9 rem
  6. 10 poke 32766,peek(45):poke 32767,peek(46):poke 45,0:poke 46,128
  7. 12 rem
  8. 13 rem has screen been loaded?
  9. 14 rem
  10. 15 if peek(31744)=26 and peek(31748)=152 then 20
  11. 16 poke 47,0:poke 48,128:poke 49,0:poke 50,128:gosub 50000
  12. 20 gosub 1000
  13. 27 rem
  14. 28 rem move video memory to mansion
  15. 29 rem
  16. 30 wq=peek(56578):xq=peek(56576):poke 56578,wq or 3:poke 56576,xq and 272 or vm
  17. 35 poke vr,dm(0):poke br,db(0):p=0:t=0
  18. 40 gosub 450
  19. 45 gosub 400:i=fre(9)
  20. 97 rem
  21. 98 rem movement loop
  22. 99 rem
  23. 100 vd=vm(peek(197)):hd=hm(peek(653)):if hd=0 and vd=0 then 100
  24. 102 rem
  25. 103 rem special command handler
  26. 104 rem
  27. 105 if vd=2 then t=75:goto 180
  28. 106 if vd=3 then 800
  29. 107 rem
  30. 108 rem check where figure will be
  31. 109 rem
  32. 110 v(p)=v(p)+vd:h(p)=h(p)+hd
  33. 111 xc(p)=peek(da(pw(p))+h(p)+40*v(p))-128
  34. 112 rem
  35. 113 rem is it a secret passage?
  36. 114 rem
  37. 115 if xc(p)>85 then 600
  38. 117 rem
  39. 118 rem is it a stair-end?
  40. 119 rem
  41. 120 if (xc(p)=62 or xc(p)=63) and pr(p)=1 then 300
  42. 122 rem
  43. 123 rem can object be moved through?
  44. 124 rem
  45. 125 if xc(p)>61 or xc(p)=0 then v(p)=xv(p):h(p)=xh(p):xc(p)=pr(p):goto 100
  46. 126 if v(p)>22 or v(p)<1 then 250
  47. 127 rem
  48. 128 rem moving off the edge?
  49. 129 rem
  50. 130 if h(p)>38 or h(p)<1 then 200
  51. 131 if v(p)>22 or v(p)<1 then 250
  52. 137 rem
  53. 138 rem put back old floor,get new
  54. 139 rem
  55. 140 print v$(xv(p))tab(xh(p))xc$(p);:xc$(p)=ch$(xc(p))
  56. 142 rem
  57. 143 rem put figure in new spot
  58. 144 rem
  59. 145 print v$(v(p))tab(h(p))pf$(p);
  60. 167 rem
  61. 168 rem if new room, print name
  62. 169 rem
  63. 170 if pr(p)<>xc(p) then gosub 460
  64. 177 rem
  65. 178 rem is player's turn over?
  66. 179 rem
  67. 180 t=t+1:if t>75 then gosub 500
  68. 190 xh(p)=h(p):xv(p)=v(p):goto 100
  69. 197 rem
  70. 198 rem horizontal move to new screen
  71. 199 rem
  72. 200 pq=3:if h(p)<1 then pq=4
  73. 205 if pw(p)=w(pw(p),pq) then h(p)=xh(p):v(p)=xv(p):goto 100
  74. 210 if h(p)<1 and pw(p)=4 then v(p)=6
  75. 211 if h(p)>38 and pw(p)=5 then v(p)=16
  76. 215 if h(p)<1 then h(p)=38:goto 270
  77. 220 h(p)=1:goto 270
  78. 247 rem
  79. 248 rem vertical move to new screen
  80. 249 rem
  81. 250 pq=2:if v(p)<1 then pq=1
  82. 255 if pw(p)=w(pw(p),pq) then h(p)=xh(p):v(p)=xv(p):goto 100
  83. 260 if v(p)<1 then v(p)=22:goto 270
  84. 265 v(p)=1:goto 270
  85. 267 rem
  86. 268 rem get new screen number
  87. 269 rem
  88. 270 pw(p)=w(pw(p),pq)
  89. 277 rem
  90. 278 rem go initialize screen
  91. 279 rem
  92. 280 gosub 900
  93. 290 goto 190
  94. 297 rem
  95. 298 rem stairway handler
  96. 299 rem
  97. 300 if pw(p)=11 then pw(p)=6:v(p)=7:h(p)=17:gosub 900:goto 190
  98. 310 if pw(p)=8 and xh(p)>12 then pw(p)=0:v(p)=14:h(p)=16:gosub 900:goto 190
  99. 315 if pw(p)=8 then pw(p)=2:v(p)=21:h(p)=9:gosub 900:goto 190
  100. 320 if pw(p)=7 then pw(p)=1:v(p)=3:h(p)=23:gosub 900:goto 190
  101. 330 if pw(p)=6 then pw(p)=11:v(p)=19:h(p)=16:gosub 900:goto 190
  102. 340 if pw(p)=5 then pw(p)=1:v(p)=15:h(p)=23:gosub 900:goto 190
  103. 350 if pw(p)=4 then pw(p)=2:v(p)=20:h(p)=16:gosub 900:goto 190
  104. 360 if pw(p)=2 and xh(p)>12 then pw(p)=4:v(p)=10:h(p)=15:gosub 900:goto 190
  105. 365 if pw(p)=2 then pw(p)=8:v(p)=21:h(p)=7:gosub 900:goto 190
  106. 370 if pw(p)=1 and xv(p)>9 then pw(p)=5:v(p)=3:h(p)=23:gosub 900:goto 190
  107. 375 if pw(p)=1 then pw(p)=7:v(p)=16:h(p)=23:gosub 900:goto 190
  108. 380 if pw(p)=0 then pw(p)=8:v(p)=20:h(p)=16:gosub 900:goto 190
  109. 390 h(p)=xh(p):v(p)=xv(p):goto 100
  110. 397 rem
  111. 398 rem un-link screen lines
  112. 399 rem
  113. 400 for i=217 to 242:poke i,peek(i)or 128:next:return
  114. 447 rem
  115. 448 rem re-print figures on screen
  116. 449 rem
  117. 450 for i=0 to np:if pw(i)=pw(p) then print v$(v(i))tab(h(i))pf$(i);
  118. 455 next
  119. 460 pr(p)=xc(p):print "[146]"v$(24)bl$v$(24)nm$(pr(p))v$(24)tab(27)"player "p+1"";
  120. 465 return
  121. 497 rem
  122. 498 rem change players
  123. 499 rem
  124. 500 t=0:p=p+1:if p>np then p=0
  125. 505 poke br,yq:print "[147]":gosub 400
  126. 510 poke br,db(pw(p)):poke vr,dm(pw(p)):print v$(24)bl$;
  127. 520 print v$(24)"[146]"nm$(pr(p))v$(24)tab(28)"player "p+1"";
  128. 530 for i=0 to 2000:next:poke 197,64:poke 653,0
  129. 540 gosub 450:return
  130. 597 rem
  131. 598 rem move through secret passages
  132. 599 rem
  133. 600 if pw(p)=3 then pw(p)=10:v(p)=5:h(p)=14:gosub 900:goto 190
  134. 601 if pw(p)=10 and h(p)<18 then pw(p)=3:v(p)=22:h(p)=29:gosub 900:goto 190
  135. 602 if pw(p)=6 then pw(p)=5:v(p)=10:h(p)=20:gosub 900:goto 190
  136. 603 if pw(p)=5 and xh(p)<22 then pw(p)=6:v(p)=3:h(p)=14:gosub 900:goto 190
  137. 604 if pw(p)=5 and v(p)<4 then pw(p)=8:v(p)=7:h(p)=5:gosub 900:goto 190
  138. 605 if pw(p)=8 and xv(p)=6 then pw(p)=5:v(p)=2:h(p)=37:gosub 900:goto 190
  139. 610 on sp goto 620,670,720
  140. 615 v(p)=xv(p):h(p)=xh(p):goto 100
  141. 620 if pw(p)=11 and pr(p)=52 then pw(p)=8:v(p)=22:h(p)=3:gosub 900:goto 190
  142. 621 if pw(p)=11 then pw(p)=11:h(p)=21:gosub 900:goto 190
  143. 622 if pw(p)=9 and pr(p)=4 then pw(p)=4:v(p)=8:h(p)=2:gosub 900:goto 190
  144. 623 if pw(p)=10 and pr(p)=4 then pw(p)=1:v(p)=13:h(p)=28:gosub 900:goto 190
  145. 624 if pw(p)=4 then pw(p)=11:v(p)=8:h(p)=3:gosub 900:goto 190
  146. 625 if pw(p)=9 then pw(p)=5:v(p)=9:h(p)=36:gosub 900:goto 190
  147. 626 if pw(p)=7 then pw(p)=10:v(p)=6:h(p)=38:gosub 900:goto 190
  148. 627 if pw(p)=10 then pw(p)=11:v(p)=6:h(p)=31:gosub 900:goto 190
  149. 628 if pw(p)=5 and xh(p)>32 then pw(p)=7:v(p)=6:h(p)=8:gosub 900:goto 190
  150. 629 if pw(p)=1 then pw(p)=9:v(p)=16:h(p)=25:gosub 900:goto 190
  151. 630 if pw(p)=8 and pr(p)=41 then pw(p)=3:v(p)=5:h(p)=7:gosub 900:goto 190
  152. 650 v(p)=xv(p):h(p)=xh(p):goto 100
  153. 670 if pw(p)=11 and pr(p)=52 then pw(p)=9:v(p)=2:h(p)=2:gosub 900:goto 190
  154. 671 if pw(p)=11 then pw(p)=11:h(p)=21:gosub 900:goto 190
  155. 672 if pw(p)=9 and pr(p)=4 then v(p)=13:gosub 900:goto 190
  156. 673 if pw(p)=10 and pr(p)=4 then pw(p)=5:v(p)=9:h(p)=37:gosub 900:goto 190
  157. 674 if pw(p)=4 then pw(p)=10:v(p)=17:h(p)=12:gosub 900:goto 190
  158. 675 if pw(p)=9 then pw(p)=0:v(p)=5:h(p)=16:gosub 900:goto 190
  159. 676 if pw(p)=7 then pw(p)=1:v(p)=12:h(p)=27:gosub 900:goto 190
  160. 677 if pw(p)=10 then pw(p)=8:v(p)=17:h(p)=2:gosub 900:goto 190
  161. 678 if pw(p)=5 and xh(p)>32 then pw(p)=11:v(p)=22:h(p)=27:gosub 900:goto 190
  162. 679 if pw(p)=1 then pw(p)=7:v(p)=6:h(p)=12:gosub 900:goto 190
  163. 680 if pw(p)=8 and pr(p)=41 then pw(p)=7:v(p)=2:h(p)=27:gosub 900:goto 190
  164. 700 v(p)=xv(p):h(p)=xh(p):goto 100
  165. 720 if pw(p)=11 and pr(p)=52 then pw(p)=5:v(p)=9:h(p)=37:gosub 900:goto 190
  166. 721 if pw(p)=11 then pw(p)=11:h(p)=21:gosub 900:goto 190
  167. 722 if pw(p)=9 and pr(p)=4 then pw(p)=7:v(p)=6:h(p)=12:gosub 900:goto 190
  168. 723 if pw(p)=10 and pr(p)=4 then v(p)=6:gosub 900:goto 190
  169. 724 if pw(p)=4 then pw(p)=9:v(p)=2:h(p)=27:gosub 900:goto 190
  170. 725 if pw(p)=9 then pw(p)=8:v(p)=10:h(p)=15:gosub 900:goto 190
  171. 726 if pw(p)=7 then pw(p)=10:v(p)=2:h(p)=12:gosub 900:goto 190
  172. 727 if pw(p)=10 then pw(p)=9:v(p)=17:h(p)=2:gosub 900:goto 190
  173. 728 if pw(p)=5 and xh(p)>32 then pw(p)=8:v(p)=18:h(p)=3:gosub 900:goto 190
  174. 729 if pw(p)=1 then pw(p)=4:v(p)=7:h(p)=2:gosub 900:goto 190
  175. 730 if pw(p)=8 and pr(p)=41 then pw(p)=11:v(p)=22:h(p)=21:gosub 900:goto 190
  176. 750 v(p)=xv(p):h(p)=xh(p):goto 100
  177. 797 rem
  178. 798 rem ending routine
  179. 799 rem
  180. 800 poke br,yq:print "[147]do you want to end this game? (y or n)"
  181. 805 poke vr,zq:poke 56578,peek(56578)or 3:poke 56576,xq
  182. 810 for i=0 to 2000:next:poke 198,0:poke 197,64
  183. 820 vd=peek(197):if vd=64 then 820
  184. 825 if vd=25 then 850
  185. 830 wq=peek(56578):xq=peek(56576):poke 56578,wq or 3:poke 56576,xq and 272 or vm
  186. 835 poke vr,dm(pw(p)):poke br,db(pw(p))
  187. 840 gosub 450
  188. 845 goto 190
  189. 850 print "do you want to start a new game?        (y or n)"
  190. 855 for i=0 to np:poke br,db(pw(i)):print v$(xv(i))tab(xh(i))""xc$(i);:next
  191. 860 poke br,yq
  192. 865 for i=0 to 2000:next:poke 198,0:poke 197,64
  193. 870 vd=peek(197):if vd=64 or (vd<>25 and vd<>39) then 870
  194. 875 if vd=25 then gosub 1120:goto 30
  195. 890 poke 31744,uq:poke 31748,vq:poke 45,peek(31744):poke 46,peek(31748)
  196. 895 poke 792,71:poke 808,237:print "[147]thanks for playing!":clr:end
  197. 897 rem
  198. 898 rem initialize new screen
  199. 899 rem
  200. 900 print v$(xv(p))tab(xh(p))xc$(p);
  201. 902 rem
  202. 903 rem reset color memory
  203. 904 rem
  204. 905 poke br,yq:print "[147]":gosub 400
  205. 907 rem
  206. 908 rem get to new screen
  207. 909 rem
  208. 910 poke vr,dm(pw(p)):poke br,db(pw(p))
  209. 912 rem
  210. 913 rem get new floor
  211. 914 rem
  212. 915 xc(p)=peek(da(pw(p))+h(p)+40*v(p))-128:if xc(p)>0 and xc(p)<62 then 930
  213. 920 h(p)=h(p)+1+38*(h(p)>37):v(p)=v(p)+1+22*(v(p)>21):goto 915
  214. 930 xc$(p)=ch$(xc(p)):gosub 450:return
  215. 997 rem
  216. 998 rem set up tables
  217. 999 rem
  218. 1000 dim w(11,6),hm(7),vm(64),mt(2,2),v$(24),ch$(63),nm$(63)
  219. 1005 dim v(5),sh(5),h(5),xh(5),xv(5),pw(5),xc(5),pr(5),pf$(5),xc$(5)
  220. 1007 rem
  221. 1008 rem vertical keystroke table
  222. 1009 rem
  223. 1010 for i=0 to 64:vm(i)=0:next:vm(6)=-1:vm(3)=1:vm(1)=3:vm(60)=2
  224. 1017 rem
  225. 1018 rem horizontal keystroke table
  226. 1019 rem
  227. 1020 for i=0 to 7:hm(i)=0:next:hm(1)=1:hm(2)=-1:hm(3)=-1
  228. 1027 rem
  229. 1028 rem vertical print table
  230. 1029 rem
  231. 1030 v$(0)="":for i=1 to 24:v$(i)=v$(i-1)+"":next
  232. 1047 rem
  233. 1048 rem wing table
  234. 1049 rem
  235. 1050 for i=0 to 11:for k=0 to 4:read a:w(i,k)=a:next:next
  236. 1060 data 0,2,0,0,1
  237. 1061 data 1,3,1,0,1
  238. 1062 data 2,2,0,2,3
  239. 1063 data 3,3,1,2,3
  240. 1064 data 4,4,4,4,5
  241. 1065 data 5,5,5,4,5
  242. 1066 data 6,8,6,6,7
  243. 1067 data 7,7,7,6,7
  244. 1068 data 8,8,6,8,8
  245. 1069 data 9,11,9,9,10
  246. 1070 data 10,10,10,9,10
  247. 1071 data 11,11,9,11,11
  248. 1072 rem
  249. 1073 rem screen code/ascii conversion
  250. 1074 rem
  251. 1075 for i=0 to 31:ch$(i)=chr$(i+64):next:for i=32 to 63:ch$(i)=chr$(i):next
  252. 1076 for i=0 to 63:ch$(i)=""+ch$(i)+"[146]":next
  253. 1077 rem
  254. 1078 rem room name table
  255. 1079 rem
  256. 1080 for i=1 to 52:read a$:nm$(i)=a$:next:for i=53 to 61:nm$(i)="doorway":next
  257. 1081 nm$(62)=nm$(1):nm$(63)=nm$(1)
  258. 1082 data "stairway","water closet","closet","crawl space","portico","porch"
  259. 1083 data "lawn","balcony","hallway","parlor","dining room","conservatory"
  260. 1084 data "kitchen","laundry","pantry","family parlor","ball room","study"
  261. 1085 data "library","tea garden","greenhouse","deck","hot tub","garage"
  262. 1086 data "billiard room","den","workshop","furnace room","chauffer's room"
  263. 1087 data "maid's room","butler's room","sauna","tapestry room"," "
  264. 1088 data "wyeth room","nursery","picasso room","vermeer room","dressing room"
  265. 1089 data "van gogh room","library balcony","computer room","train room"
  266. 1090 data "play room","freddy's room","cecil's room","amy's room"
  267. 1091 data "governess's cupboard","school room","studio","high balcony"
  268. 1092 data "secret room"
  269. 1097 rem
  270. 1098 rem set initial values
  271. 1099 rem
  272. 1100 for i=0 to 5:pf$(i)="@[146][149]":next:for i=0 to 5:read a$:pf$(i)=a$+pf$(i):next
  273. 1105 data "[129]","[151]","","[154]","","[155]"
  274. 1110 bl$="                                     "
  275. 1115 for i=0 to 5:read a:sh(i)=a:next
  276. 1116 data 5,9,13,17,21,25
  277. 1120 for i=0 to 5:h(i)=sh(i):v(i)=15:pw(i)=0:xh(i)=h(i):xv(i)=v(i):next
  278. 1125 for i=0 to 5:xc(i)=peek(da(pw(i))+h(i)+40*v(i))-128:xc$(i)=ch$(xc(i)):next
  279. 1127 rem
  280. 1128 rem get player number
  281. 1129 rem
  282. 1130 print v$(24)"how many players?  (1-6)             ";:poke 197,64:poke 198,0
  283. 1135 get a$:if a$="" then 1135
  284. 1140 if asc(a$)<49 or asc(a$)>54 then 1135
  285. 1145 np=val(a$)-1:print v$(24)bl$v$(24)np+1" players--is this right? (y or n)";
  286. 1150 poke 197,64:poke 198,0
  287. 1155 get a$:if a$="" then 1155
  288. 1160 if a$<>"y" then 1130
  289. 1170 sp=1+int(3*rnd(9)):if sp<1 or sp>3 then 170
  290. 1180 poke 792,193:poke 808,239
  291. 1185 for i=23 to 0 step-1:print v$(i)tab(39)"!";:next
  292. 1190 return
  293. 49997 rem
  294. 49998 rem set up display
  295. 49999 rem
  296. 50000 dim db(11),dm(11),da(11):poke 53281,7:poke 53280,11:poke 657,128
  297. 50005 uq=peek(32766):vq=peek(32767)
  298. 50007 rem
  299. 50008 rem set up color memory
  300. 50009 rem
  301. 50010 print "[149][147]";:for i=0 to 23:print"please find the murderer in the mansion"
  302. 50020 next
  303. 50027 rem
  304. 50028 rem set video mem & char mem
  305. 50029 rem
  306. 50030 vm=2:vb=16384:cm=14:cb=vb+cm*1024:for i=0 to 11:dm(i)=cm+16*(i+2):next
  307. 50040 vr=53272:zq=peek(vr)
  308. 50047 rem
  309. 50048 rem set basic pointers
  310. 50049 rem
  311. 50050 for i=0 to 11:db(i)=int((vb+1024*(i+2))/256):next
  312. 50055 for i=0 to 11:da(i)=db(i)*256:next
  313. 50060 br=648:yq=peek(br)
  314. 50067 rem
  315. 50068 rem get old video pointers
  316. 50069 rem
  317. 50070 wq=peek(56578):xq=peek(56576)
  318. 50077 rem
  319. 50078 rem set load flag
  320. 50079 rem
  321. 50080 q9=q8
  322. 50088 rem get screen display & char set
  323. 50089 rem
  324. 50090 load "display data",8,1
  325. 50093 rem
  326. 50094 rem note: loading sends program back to beginning
  327. 50095 rem
  328. 50099 rem
  329.